//
//  SYS_HomeCenterView.m
//  System_App
//
//  Created by 吴健 on 2017/11/28.
//  Copyright © 2017年 czy001. All rights reserved.
//

#import "SYS_HomeCenterView.h"

@implementation SYS_HomeCenterView

- (id)initWithFrame:(CGRect)frame{
    if (self == [super initWithFrame:frame]) {
        self.frame = frame;
        [self setUI];
    }
    return self;
}

#pragma mark -- setter and getter
- (void)setUI{
    UIView *v_bg = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREENWIDTH, self.frame.size.height)];
    v_bg.backgroundColor = DSCOLOR_WHITE;
    [self addSubview:v_bg];
    
    UIView *v_left = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREENWIDTH/2-0.5, self.frame.size.height)];
    [v_bg addSubview:v_left];
    
    UIImageView *imv_order = [UIImageView new];
    imv_order.image = WJIMAGE(@"home_orderNum");
    [v_left addSubview:imv_order];
    
    UILabel *lb_left = [UILabel new];
    lb_left.text = @"今日付款单数:";
    lb_left.textAlignment = NSTextAlignmentCenter;
    lb_left.font = DSFONT_DETAIL;
    [v_left addSubview:lb_left];
    
    _todayOrderLabel = [UILabel new];
    _todayOrderLabel.text = @"0";
    _todayOrderLabel.textColor = [UIColor blueColor];
    _todayOrderLabel.textAlignment = NSTextAlignmentCenter;
    [v_left addSubview:_todayOrderLabel];
    
    _allOrderLabel = [UILabel new];
    _allOrderLabel.textAlignment = NSTextAlignmentCenter;
    _allOrderLabel.font = DSFONT_MIN;
    _allOrderLabel.text = @"总单数:0";
    _allOrderLabel.textColor = DSCOLOR_GARY_TITLE;
    [v_left addSubview:_allOrderLabel];
    
    
    UIView *v_line = [[UIView alloc] initWithFrame:CGRectMake(SCREENWIDTH/2-0.5, 0, 1, self.frame.size.height)];
    v_line.backgroundColor = DSCOLOR_GRAY_LINE;
    [v_bg addSubview:v_line];
    
    UIView *v_right = [[UIView alloc]initWithFrame:CGRectMake(SCREENWIDTH/2+0.5, 0, SCREENWIDTH/2-0.5, self.frame.size.height)];
    [v_bg addSubview:v_right];
    
    UIImageView *imv_member = [UIImageView new];
    imv_member.image = WJIMAGE(@"home_memberNum");
    [v_right addSubview:imv_member];
    
    UILabel *lb_right = [UILabel new];
    lb_right.text = @"今日新增会员数:";
    lb_right.textAlignment = NSTextAlignmentCenter;
    lb_right.font = DSFONT_DETAIL;
    [v_right addSubview:lb_right];
    
    _todayMemberLabel = [UILabel new];
    _todayMemberLabel.text = @"0";
    _todayMemberLabel.textColor = DSCOLOR_GREEN;
    _todayMemberLabel.textAlignment = NSTextAlignmentCenter;
    [v_right addSubview:_todayMemberLabel];
    
    _allMemberLabel = [UILabel new];
    _allMemberLabel.textAlignment = NSTextAlignmentCenter;
    _allMemberLabel.font = DSFONT_MIN;
    _allMemberLabel.text = @"总单数:0";
    _allMemberLabel.textColor = DSCOLOR_GARY_TITLE;
    [v_right addSubview:_allMemberLabel];
    
    
    lb_left.sd_layout
    .topSpaceToView(v_left, 10)
    .centerXEqualToView(v_left).offset(10)
    .heightIs(20)
    .widthIs(100);
    
    imv_order.sd_layout
    .rightSpaceToView(lb_left, 5)
    .centerYEqualToView(lb_left)
    .widthIs(20)
    .heightIs(20);
    
    _todayOrderLabel.sd_layout
    .topSpaceToView(lb_left, 5)
    .leftSpaceToView(v_left, 0)
    .rightSpaceToView(v_left, 0)
    .heightIs(20);
    
    _allOrderLabel.sd_layout
    .topSpaceToView(_todayOrderLabel, 5)
    .leftSpaceToView(v_left, 0)
    .rightSpaceToView(v_left, 0)
    .heightIs(15);
    
    lb_right.sd_layout
    .topSpaceToView(v_right, 10)
    .centerXEqualToView(v_right).offset(10)
    .heightIs(20)
    .widthIs(110);
    
    imv_member.sd_layout
    .rightSpaceToView(lb_right, 5)
    .centerYEqualToView(lb_right)
    .widthIs(20)
    .heightIs(20);
    
    _todayMemberLabel.sd_layout
    .topSpaceToView(lb_right, 5)
    .leftSpaceToView(v_right, 0)
    .rightSpaceToView(v_right, 0)
    .heightIs(20);
    
    _allMemberLabel.sd_layout
    .topSpaceToView(_todayMemberLabel, 5)
    .leftSpaceToView(v_right, 0)
    .rightSpaceToView(v_right, 0)
    .heightIs(15);
    
}

@end
